import * as React from 'react';
import { watermark } from '../utils/watermark'

export default class WaterMark extends React.Component {
    constructor(props) {
        super(props);

        this.container = null;
    }

    componentDidMount() {

        const { style, options } = this.props;
        watermark({
            container: this.container,
            ...options
        });
    }

    render() {
        const style = {
            position: 'relative',
            ...this.props.style,
        };
        const { children } = this.props
        return (
            <div ref={(el) => { this.container = el }} id="watermark" style={style}>
                {children}
            </div>
        );
    }
}
